<?php
session_start();
require_once "../funciones.php";
$_SESSION['caweb']['basededatos'] = "caweb";
$_SESSION['caweb']['soporte'] = "mantis12";


    $caweb = con_caweb();
    $sql = "select cliente from basefacturacion group by cliente";



$tot = 0;
$result = mysql_query($sql);
while($fila = mysql_fetch_array($result)){
    $nit = $fila[cliente];
    $mantis = con_mantis();
    $sql = "select * from mantis_project_table where nit = '$nit'";
    $result1 = mysql_query($sql);
    $base = mysql_fetch_array($result1);
    if (!is_array($base)){
        $caweb = con_caweb();
        $sql = "update basefacturacion set sucrusalfactura = sucrusal where cliente = '$nit'";
        $result2 = mysql_query($sql);
    }
}
echo "<h1>$tot</h1>"



/*
 *         $caweb = con_caweb();
        $sql = "select * from basefacturacion where cliente = '$nit'";
        $result2 = mysql_query($sql);
        echo "<h1>Para el Nit $nit</h1>";
        while($mos = mysql_fetch_array($result2)){
            echo $mos[interno]." estado : ".$mos[estado]." facturable: ".$mos[facturable]."<br />";
            $tot ++;
        }

 */

?>
